<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/avatar.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/avatar.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/avatar.png">
  <link rel="mask-icon" href="/images/avatar.png" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"notes.maxwi.com","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":true,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":true,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="之所以编写本文一方面是为了练习使用这个全新的博客系统，另一方面也为记录在搭建本站时遇到的问题。虽然很多问题网上都有相关的解决的方法，但由于hexo版本的更新以及问题的修复，网上很多方法都已经不在试用，特别是默认模板由最初的light改为了landscape等一个大块代码的更新导致网上的好多修改方法都不再试用。这里有些地方也没有做到完整请谅解，如果有更好的方法，记得提醒我哈。我只是对linux及嵌入">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo+github搭建个人博客环境及hexo配置">
<meta property="og:url" content="http://notes.maxwi.com/2014/02/22/first-post/index.html">
<meta property="og:site_name" content="blueyi&#39;s notes">
<meta property="og:description" content="之所以编写本文一方面是为了练习使用这个全新的博客系统，另一方面也为记录在搭建本站时遇到的问题。虽然很多问题网上都有相关的解决的方法，但由于hexo版本的更新以及问题的修复，网上很多方法都已经不在试用，特别是默认模板由最初的light改为了landscape等一个大块代码的更新导致网上的好多修改方法都不再试用。这里有些地方也没有做到完整请谅解，如果有更好的方法，记得提醒我哈。我只是对linux及嵌入">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="http://notes.maxwi.com/images/github-logo.png">
<meta property="og:image" content="http://notes.maxwi.com/images/20140225/01.png">
<meta property="og:image" content="http://notes.maxwi.com/images/20140225/02.png">
<meta property="article:published_time" content="2014-02-22T04:16:53.000Z">
<meta property="article:modified_time" content="2014-02-22T04:16:53.000Z">
<meta property="article:author" content="blueyi">
<meta property="article:tag" content="Hexo">
<meta property="article:tag" content="ubuntu">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://notes.maxwi.com/images/github-logo.png">

<link rel="canonical" href="http://notes.maxwi.com/2014/02/22/first-post/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'en'
  };
</script>

  <title>hexo+github搭建个人博客环境及hexo配置 | blueyi's notes</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="blueyi's notes" type="application/atom+xml">
<link rel="alternate" href="/rss2.xml" title="blueyi's notes" type="application/rss+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">blueyi's notes</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Follow Excellence,Success will chase you!</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>Home</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>Categories</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>Archives</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>Tags</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>About</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>Search
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="Searching..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="http://notes.maxwi.com/2014/02/22/first-post/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/default_avatar.jpg">
      <meta itemprop="name" content="blueyi">
      <meta itemprop="description" content="心怀善意，虛怀若谷！">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="blueyi's notes">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hexo+github搭建个人博客环境及hexo配置
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2014-02-22 12:16:53" itemprop="dateCreated datePublished" datetime="2014-02-22T12:16:53+08:00">2014-02-22</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo/" itemprop="url" rel="index"><span itemprop="name">hexo</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="Symbols count in article">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">Symbols count in article: </span>
              <span>3.9k</span>
            </span>
            <span class="post-meta-item" title="Reading time">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">Reading time &asymp;</span>
              <span>4 mins.</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>之所以编写本文一方面是为了练习使用这个全新的博客系统，另一方面也为记录在搭建本站时遇到的问题。虽然很多问题网上都有相关的解决的方法，但由于hexo版本的更新以及问题的修复，网上很多方法都已经不在试用，特别是默认模板由最初的light改为了landscape等一个大块代码的更新导致网上的好多修改方法都不再试用。这里有些地方也没有做到完整请谅解，如果有更好的方法，记得提醒我哈。我只是对linux及嵌入式和互联网感兴趣，没有学过任何一门的网页语言，所以问题及解决方法的拙劣之处还请谅解。<br>有时候折腾的时候遇到问题一直解决不了很想放弃，总是中放弃之后又不甘心，又来重试，如此反复，直到解决完问题后心里非常舒服，感觉如释重负一般，其实有时候回过头来一看，或者让身边人一看也许他会觉得-那么长时间就整个这？这其中的感觉恐怕很多时候只有自己才会理解了！  </p>
<span id="more"></span>

<h2 id="什么是hexo"><a href="#什么是hexo" class="headerlink" title="什么是hexo"></a>什么是hexo</h2><p>Hexo 是一款基于node 的静态博客网站生成器<br>作者 ：tommy351是一个台湾的在校大学生。。。<br>相比其他的静态网页生成器而言有着，生成静态网页最快，插件丰富（已经移植了大量Octopress插件）。同其他很多轻量级博客如jekyll、octopress、jekyllbootstrap等一样，也是<br>使用Markdown语法进行编辑博文，关于Markdown不用怕，推荐搜索维基上面的语法示例，有中文版本<a target="_blank" rel="noopener" href="http://zh.wikipedia.org/wiki/Markdown">http://zh.wikipedia.org/wiki/Markdown</a>，只需要会非常简单的常用语法就可以了。关于以上这些轻量仍博客系统哪一个更好，各有各的优缺点，其中jekyll是它们的基础，不过配置要麻烦一些。octopress的中文资料好像是最全的，不过generate速度太慢了点。</p>
<p><strong>hexo的github主页地址：</strong><br><a target="_blank" rel="noopener" href="https://github.com/tommy351/hexo">https://github.com/tommy351/hexo</a><br><strong>hexo的官方文档首页：</strong><br><a target="_blank" rel="noopener" href="http://zespia.tw/hexo/docs/index.html">http://zespia.tw/hexo/docs/index.html</a>  </p>
<hr>
<h2 id="什么是github"><a href="#什么是github" class="headerlink" title="什么是github"></a>什么是github</h2><p><img data-src="/images/github-logo.png" alt="github-logo"><br><strong>github官方网站：</strong><a target="_blank" rel="noopener" href="https://github.com">https://github.com</a><br><strong>github官方帮助网站：</strong><a target="_blank" rel="noopener" href="https://help.github.com/">https://help.github.com/</a><br>    当然官方帮助文档都是英文，不过配合词典应该也都不是问题，如果看了官方后依然是一头雾水，觉得挺复杂，那暂时可以先不管，就把它理解为基于git版本控制的代码仓库就可以了。关于git是什么可以自行<a target="_blank" rel="noopener" href="http://www.google.com">google</a>,如果暂时先不想看那就把它理解为一个分布式版本控制/软件配置管理软件，也就是一个控制代码版本的，就当成github是在线版本的吧。<br><strong>git官方文档:</strong><a target="_blank" rel="noopener" href="http://git-scm.com/documentation">http://git-scm.com/documentation</a><br><strong>git常用命令：</strong>请点击<a href="">git常用命令记录</a>  </p>
<hr>
<h2 id="搭建过程如下："><a href="#搭建过程如下：" class="headerlink" title="搭建过程如下："></a>搭建过程如下：</h2><h3 id="注册github"><a href="#注册github" class="headerlink" title="注册github"></a>注册github</h3><p>注册github账号并验证邮箱,登录后了解主页面各选项基本内容<br>这里需要特别注意的是邮箱一定要验证通过，点击github首页右上角设置图标如截图所示，Email(will be public)以及Emails栏目下的邮箱都不能有“！”号出现，不然你等一下就算建立了github pages也是无法打开的，会显示404错误。<br><img data-src="/images/20140225/01.png" alt="git注册1">  </p>
<hr>
<h3 id="创建repository"><a href="#创建repository" class="headerlink" title="创建repository"></a>创建repository</h3><p>创建repository,并填写你的个人信息以创建你自己的github pages<br>这是需要特别注意的就是Repository name必须是您的usename(也就是你可以用于登录github官网的名字)或者是你建立的组织的名字。否则你建立的仓库是不能作为pages被github解析的。其他选项默认即可，这里是github pages的官方链接<a target="_blank" rel="noopener" href="http://pages.github.com/">http://pages.github.com/</a>，可以自行查看一下说明。<br><img data-src="/images/20140225/02.png" alt="repository">  </p>
<hr>
<h3 id="ubuntu上安装本地环境"><a href="#ubuntu上安装本地环境" class="headerlink" title="ubuntu上安装本地环境"></a>ubuntu上安装本地环境</h3><p> hexo 依赖于<code>Node.js</code>和<code>Git</code>所以下面分别开始安装这两个软件  </p>
<h4 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h4><p>ubuntu安装git直接apt-get就可以了  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">sudo apt-get install git-core</span>  </span><br></pre></td></tr></table></figure>
<h4 id="安装Node-js"><a href="#安装Node-js" class="headerlink" title="安装Node.js"></a>安装Node.js</h4><p>hexo官方推荐的安装方法是使用nvm，这里我们也使用nvm进行安装，当然你也可以使用直接安装，不过貌似nvm安装之后会直接在个人目录下产生<code>.nvm</code>目录并且通过<code>.bashrc</code>或者<code>.bash_profile</code>进行开机加载，然后其他的nvm操作都会保存在&gt;.nvm目录，这样方便以后升级或者重装系统，相当于绿色软件了。<br>nvm的github主页<a target="_blank" rel="noopener" href="https://github.com/creationix/nvm">https://github.com/creationix/nvm</a><br>安装nvm可以使用以下两个命令中的任意一个都可以<br>cURL:  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">curl https://raw.github.com/creationix/nvm/master/install.sh | sh</span>  </span><br></pre></td></tr></table></figure>
<p>或者Wget:  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash"> wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh</span></span><br></pre></td></tr></table></figure>
<p>等待nvm安装完成之后重新启动你的终端然后运行以下命令安装Node.js  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">nvm install 0.10</span> </span><br></pre></td></tr></table></figure>
<p>我这里安装的node.js版本是0.10.26可用使用<code>nvm ls</code>命令查看<br>至此本地环境安装完成</p>
<hr>
<h3 id="安装并初始化Hexo"><a href="#安装并初始化Hexo" class="headerlink" title="安装并初始化Hexo"></a>安装并初始化Hexo</h3><p>使用npm命令安装hexo  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">npm install -g hexo</span></span><br></pre></td></tr></table></figure>
<p>这里有两点需要提醒一下：  </p>
<ul>
<li>1、如果提示command not found，请检查是否已经重新启动终端或者使用<code>nvm ls</code>检查当前使用的node.js的版本，如果没有则使用以下命令来使用刚安装的版本。</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">nvm use 0.10.26</span>  </span><br></pre></td></tr></table></figure>
<p>或者使用以下命令直接设置全局的默认node.js版本  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">nvm <span class="built_in">alias</span> default 0.10.26</span>  </span><br></pre></td></tr></table></figure>
<ul>
<li>2、如果npm  安装hexo是速度太慢，或者包安装失败，应该是您的网络无法连接到官方服务器，或者是GFW的问题，请使用以下方法更改npm镜像源:  </li>
</ul>
<p>1.通过config命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">npm config <span class="built_in">set</span> registry http://registry.cnpmjs.org</span>  </span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">npm info underscore (如果上面配置成功，使用这个命令会有以下提示)</span>  </span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">npm http GET http://registry.cnpmjs.org/underscore</span>  </span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">npm http 200 http://registry.cnpmjs.org/underscore</span>  </span><br></pre></td></tr></table></figure>
<p>2.命令行指定  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">npm --registry http://registry.cnpmjs.org info underscore</span>  </span><br></pre></td></tr></table></figure>
<p>3.编辑 ~/.npmrc 加入以下内容可以使配置永久生效，就不用每次npm安装时都要运行指定源命令了  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">registry = http://registry.cnpmjs.org</span>  </span><br></pre></td></tr></table></figure>
<p>使用以下命令对hexo进行初始化（这里我位于<del>目录，而且我想把我的个人博客放在</del>/hexo目录，需要放在其他目录直接改一下自己需要的目录就可以了）  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo init hexo</span>  </span><br></pre></td></tr></table></figure>
<p>现在本地版本的hexo已经配置完成了，可以使用以下命令来生成静态文件  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo generate</span>  </span><br></pre></td></tr></table></figure>
<p>或者  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo g</span>  </span><br></pre></td></tr></table></figure>
<p>使用以下命令启动本地服务器进行预览  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo server</span>  </span><br></pre></td></tr></table></figure>
<p>或者  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo s</span>  </span><br></pre></td></tr></table></figure>
<p>然后通过<a target="_blank" rel="noopener" href="http://localhost:4000/">http://localhost:4000/</a>进行访问，如果页面正常打开，那么恭喜你，你的本地博客已经搭建完成，还差一点点就可以进行发布了。  </p>
<hr>
<h3 id="配置git并发布"><a href="#配置git并发布" class="headerlink" title="配置git并发布"></a>配置git并发布</h3><p>配置git并发布基于hexo和github的个人博客<br>首先编辑你hexo安装目录下的<code>_config.yml</code>文件，找到以下内容并修改为github</p>
<blockquote>
<p>deploy:<br>   type: github<br>   repository: <a target="_blank" rel="noopener" href="https://github.com/username/username.github.io.git">https://github.com/username/username.github.io.git</a><br>   branch: master  </p>
</blockquote>
<p>运行以下命令设置你的git全局变量,即设置你的用户名和邮箱  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git config --global user.name <span class="string">&quot;Your Name Here&quot;</span></span>  </span><br><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">git config --global user.email <span class="string">&quot;your_email@example.com&quot;</span></span></span><br></pre></td></tr></table></figure>
<p>好了，现在已经可以使用以下命令将你的博客发布到github上了，当然需要根据提示输入你的用户名和密码  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo deploy</span>  </span><br></pre></td></tr></table></figure>
<p>或者   </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$ </span><span class="language-bash">hexo d</span>  </span><br></pre></td></tr></table></figure>
<p>记得每次运行hexo deploy之前先运行hexo generate生成你本地博客的最新版本<br>如果需要将博客页面中的个人信息修改成你自己的信息，请编辑并认真查看~/hexo目录下的<code>_config.yml</code>文件，强烈推荐多查看官方帮助文档中的说明。关于主题的修改及配置，还有添加其他RSS插件、多说插件等，请参见其他文章。<br><strong>* 关于绑定个人域名 *</strong> </p>
<p>github在这方面非常方便，直接在source目录下创建CNAME文件，内容为你需要绑定的域名，例如本博客就是<a href="http://notes.maxwi.com">notes.maxwi.com</a>，然后在你的域名管理处添加一项CNAME记录，记录值为你的github page的地址，例如：<code>username.github.io.</code>然后重新<code>hexo g</code>和<code>hexo d</code>即可，根据github官方说明大概需要10分钟生效。如果你需要绑定的是一级域名需要创建一个A记录，记录值为<code>207.97.227.245</code>   </p>
<p><strong>至此你在github上的个人博客就搭建完成了，如果有任何问题请留言或者查询本博客的其它博文说明。</strong>   </p>
<h2 id="常见问题记录"><a href="#常见问题记录" class="headerlink" title="常见问题记录"></a>常见问题记录</h2><p><strong>1、为什么我的hexo上的文章目录一闪而过</strong><br>这个问题找了好久才发现，刚开始以为是因为文件头部没有<code>toc: ture</code>引起的，后来添加上了，问题依然有，经过无数次尝试才发现是因为这些文章里面的标题都是从三级标题开始的。所以要想让标题显示正常至少应该从二级标题开始，也就是要有<code>##</code>。这应该是pacman主题的一个bug吧。</p>

    </div>

    
    
    
        

  <div class="followme">
    <p>Welcome to my other publishing channels</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/atom.xml">
            <span class="icon">
              <i class="fa fa-rss"></i>
            </span>

            <span class="label">RSS</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Hexo/" rel="tag"># Hexo</a>
              <a href="/tags/ubuntu/" rel="tag"># ubuntu</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item"></div>
      <div class="post-nav-item">
    <a href="/2014/03/18/Replace-two-character-with-one/" rel="next" title="替换任意长度字符串中的两个字符为指定的一个">
      替换任意长度字符串中的两个字符为指定的一个 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="gitalk-container"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFhexo"><span class="nav-number">1.</span> <span class="nav-text">什么是hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFgithub"><span class="nav-number">2.</span> <span class="nav-text">什么是github</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%90%AD%E5%BB%BA%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A"><span class="nav-number">3.</span> <span class="nav-text">搭建过程如下：</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%B3%A8%E5%86%8Cgithub"><span class="nav-number">3.1.</span> <span class="nav-text">注册github</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BArepository"><span class="nav-number">3.2.</span> <span class="nav-text">创建repository</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ubuntu%E4%B8%8A%E5%AE%89%E8%A3%85%E6%9C%AC%E5%9C%B0%E7%8E%AF%E5%A2%83"><span class="nav-number">3.3.</span> <span class="nav-text">ubuntu上安装本地环境</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%AE%89%E8%A3%85Git"><span class="nav-number">3.3.1.</span> <span class="nav-text">安装Git</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%AE%89%E8%A3%85Node-js"><span class="nav-number">3.3.2.</span> <span class="nav-text">安装Node.js</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E5%B9%B6%E5%88%9D%E5%A7%8B%E5%8C%96Hexo"><span class="nav-number">3.4.</span> <span class="nav-text">安装并初始化Hexo</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%85%8D%E7%BD%AEgit%E5%B9%B6%E5%8F%91%E5%B8%83"><span class="nav-number">3.5.</span> <span class="nav-text">配置git并发布</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%AE%B0%E5%BD%95"><span class="nav-number">4.</span> <span class="nav-text">常见问题记录</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="blueyi"
      src="/images/default_avatar.jpg">
  <p class="site-author-name" itemprop="name">blueyi</p>
  <div class="site-description" itemprop="description">心怀善意，虛怀若谷！</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">104</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">26</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">68</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/blueyi" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;blueyi" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://maxwi.com/" title="http:&#x2F;&#x2F;maxwi.com" rel="noopener" target="_blank">Maxwi</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 2014 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">blueyi</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="Symbols count total">750k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="Reading time total">11:22</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a>
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/pjax/pjax.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>

<script src="/js/utils.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>

<script src="/js/bookmark.js"></script>

  <script>
var pjax = new Pjax({
  selectors: [
    'head title',
    '#page-configurations',
    '.content-wrap',
    '.post-toc-wrap',
    '.languages',
    '#pjax'
  ],
  switches: {
    '.post-toc-wrap': Pjax.switches.innerHTML
  },
  analytics: false,
  cacheBust: false,
  scrollTo : !CONFIG.bookmark.enable
});

window.addEventListener('pjax:success', () => {
  document.querySelectorAll('script[data-pjax], script#page-configurations, #pjax script').forEach(element => {
    var code = element.text || element.textContent || element.innerHTML || '';
    var parent = element.parentNode;
    parent.removeChild(element);
    var script = document.createElement('script');
    if (element.id) {
      script.id = element.id;
    }
    if (element.className) {
      script.className = element.className;
    }
    if (element.type) {
      script.type = element.type;
    }
    if (element.src) {
      script.src = element.src;
      // Force synchronous loading of peripheral JS.
      script.async = false;
    }
    if (element.dataset.pjax !== undefined) {
      script.dataset.pjax = '';
    }
    if (code !== '') {
      script.appendChild(document.createTextNode(code));
    }
    parent.appendChild(script);
  });
  NexT.boot.refresh();
  // Define Motion Sequence & Bootstrap Motion.
  if (CONFIG.motion.enable) {
    NexT.motion.integrator
      .init()
      .add(NexT.motion.middleWares.subMenu)
      .add(NexT.motion.middleWares.postList)
      .bootstrap();
  }
  NexT.utils.updateSidebarPosition();
});
</script>




  
  <script data-pjax>
    (function(){
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x=document.getElementsByTagName("link");
		//Find the last canonical URL
		if(x.length > 0){
			for (i=0;i<x.length;i++){
				if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
					canonicalURL=x[i].href;
				}
			}
		}
    //Get protocol
	    if (!canonicalURL){
	    	curProtocol = window.location.protocol.split(':')[0];
	    }
	    else{
	    	curProtocol = canonicalURL.split(':')[0];
	    }
      //Get current URL if the canonical URL does not exist
	    if (!canonicalURL) canonicalURL = window.location.href;
	    //Assign script content. Replace current URL with the canonical URL
      !function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
  </script>




  
<script src="/js/local-search.js"></script>













    <div id="pjax">
  

  

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css">

<script>
NexT.utils.loadComments(document.querySelector('#gitalk-container'), () => {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js', () => {
    var gitalk = new Gitalk({
      clientID    : '0f8243eb2c8b2207980f',
      clientSecret: 'd159633a33519d3b7a48b0ca729032f7d1f38a41',
      repo        : 'notes',
      owner       : 'blueyi',
      admin       : ['blueyi'],
      id          : 'ad5f423484acaf003730c4b963ba9d18',
        language: '',
      distractionFreeMode: true
    });
    gitalk.render('gitalk-container');
  }, window.Gitalk);
});
</script>

    </div>
</body>
</html>
